<template>
  <view class="time-box">
    <view class="box-title">
      营业时间
      <img
        class="time-close"
        src="https://cdn1.visiotrip.com/h5AndMini/2023-11-17/time-close.png"
        @click="close"
      />
    </view>
    <scroll-view scroll-y class="box-info">
      <view class="info-center" v-for="(item,index) in time.business" :key="index">
        <view class="info-title">{{item.title}}</view>
        <view class="info-list">
          <view class="info-item" v-for="(weekItem,weekIndex) in item.weekInfo" :key="weekIndex">
            <view class="item-week">{{weekItem.time}}</view>
            <view class="item-day">
              <img
                class="time-icon"
                src="https://cdn1.visiotrip.com/h5AndMini/2023-11-17/time-icon.png"
              />
              <view class="hours-box">
                <view class="day-hours">{{weekItem.begin}}-{{weekItem.end}}</view>
                <view class="day-hours">{{weekItem.desc}}</view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </scroll-view>
  </view>
</template>

<script>
export default {
  props: {
    time: {
      type: Object,
    },
  },
  methods: {
    close() {
        this.$emit("close");
    },
},
};
</script>

<style lang="scss" scoped>
.time-box {
  width: 650rpx;
  max-height: 525rpx;
  background: #ffffff;
  border-radius: 26rpx;
  padding: 60rpx 0 20rpx 0;
  .box-title {
    height: 44rpx;
    width: 100%;
    text-align: center;
    line-height: 44rpx;
    position: relative;
    color: $sl-color-black;
    font-size: 32rpx;
    font-weight: 600;
    margin: 0 0 30rpx 0;
    .time-close {
      position: absolute;
      width: 44rpx;
      height: 44rpx;
      right: 32rpx;
      top: 0;
    }
  }
  .box-info {
    width: 570rpx;
    max-height: 345rpx;
    background: #f6f6f9;
    border-radius: 26rpx;
    margin: 0 auto;
    .info-center {
      width: 474rpx;
      margin: 0 auto;
      .info-title {
        width: 100%;
        border-bottom: 1rpx solid #dddddd;
        padding: 30rpx 0;
        margin-top: 10rpx;
        color: $sl-color-grey;
        font-size: 28rpx;
      }
      .info-list {
        .info-item {
            margin-top: 30rpx;
          .item-week {
            color: $sl-color-grey;
            font-size: 28rpx;
          }
          .item-day {
            display: flex;
            margin: 20rpx 0 0 0;
            .time-icon {
              width: 22rpx;
              height: 22rpx;
              margin-right: 10rpx;
              margin-top: 5rpx;
            }
            .hours-box {
              display: flex;
              flex-wrap: wrap;
              align-items: center;

              min-height: 24rpx;
              flex: 1;
              .day-hours {
                color: $sl-color-grey;
                font-size: 28rpx;
                margin-right: 32rpx;
                height: 32rpx;
                line-height: 32rpx;
                margin-bottom: 10rpx;
              }
            }
          }
        }
      }
    }
  }
}
</style>
